<div class="container-fluid">
    <div class="wrapper">
        <div class="panel" id="nav">
            <div class="panel-heading"><h3 class="panel-title">已收货待入库的采购单</h3></div>
            <div class="panel-body">
                <form action="__URL__/recieved_wait_storage" method="get">

                    <div class="col-sm-12 col-md-3  add-space">
                        <div class="input-group input-group-md">
                            <span class="input-group-addon">采购单号</span>
                            <input type="text" name="id" class="form-control" value="">
                        </div>
                    </div>

                    <div class="col-sm-12 col-md-6  add-space">
                        <div class="input-group input-group-md">
                            <span class="input-group-addon">收货日期</span>
                            <input class="form-control form-datetime" type="text" name="recieve_time_from"
                                   style="cursor:pointer;" readonly>
                            <span class="input-group-addon"><span class="icon-calendar"></span></span>
                            <input class="form-control form-datetime" type="text" name="recieve_time_to"
                                   style="cursor:pointer;" readonly>
                        </div>
                    </div>

                    <div class="col-sm-12 col-md-3  add-space">
                        <div class="input-group input-group-md">
                            <span class="input-group-addon">批次号</span>
                            <input type="text" name="batch_code" class="form-control" value="">
                        </div>
                    </div>

                    <div class="col-sm-12 col-md-3  add-space">
                        <div class="input-group input-group-md">
                            <span class="input-group-addon">状态</span>
                            <select name="status" class="form-control">
                                <option value="">--请选择--</option>
                                <option value="20">已打印</option>
                                <option value="40">未完全到货</option>
                                <option value="50">完全到货</option>
                                <option value="60">已质检</option>
                                <option value="65">未完全入库</option>
                            </select>
                        </div>
                    </div>

                    <div class="col-md-3 add-space">
                        <input class="btn btn-primary" type="submit" value="查询">
                        <input class="btn btn-primary" type="button" onclick="reset()" value="重置">
                        <input class="btn btn-primary" type="button" value="下载" id="download">
                    </div>

                </form>
                <div class="clearfix"></div>
                <hr>
                <table class="table table-striped  table-hover" cellspacing="0" width="100%">
                    <thead>
                    <tr>
                        <th>采购单号</th>
                        <th>收货单号</th>
                        <th>收货明细单号</th>
                        <th>批次号</th>
                        <th>SKU</th>
                        <th>SKU中文名称</th>
                        <th>采购数</th>
                        <th>收货数</th>
                        <th>质检数</th>
                        <th>所属仓库</th>
                        <th>收货人</th>
                        <th>收货时间</th>
                        <th>站点</th>
                        <th>状态</th>
                    </tr>
                    </thead>
                    <tbody>
                    <volist name="data" id="val">
                        <tr>
                            <td>{$val.purchaseorder_id}</td>
                            <td>{$val.mainid}</td>
                            <td>{$val.id}</td>
                            <td>{$val.batch_code}</td>
                            <td>{$val.sku}</td>
                            <td>{$val.sku_name}</td>
                            <td>{$val.purchase_quantity}</td>
                            <td>{$val.arrival_quantity}</td>
                            <td>{$val.check_count}</td>

                            <td>{$val.transfer_hopper_id}</td>
                            <td>{$val.recieve_man}</td>
                            <td>{$val.recieve_time}</td>
                            <td>{$val.site_id}</td>
                            <td>{$val.status}</td>
                        </tr>
                    </volist>
                    </tbody>
                </table>
                <div class="clearfix clear"></div>
                <div class="row">
                    <div class="col-md-6 pull-left">
                        <label>每页 20 条记录
                            显示 1 到 20 项，共 {$count}项</label>
                    </div>
                    <div class="col-md-6">
                        <div class="page pull-right" style="padding: 0;margin: 0">
                            {$page}
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    $(function () {
        $("input[name='id']").val("<?php echo $_GET['id'];?>");
        $("input[name='recieve_time_from']").val("<?php  echo $_GET['recieve_time_from'];?>");
        $("input[name='recieve_time_to']").val("<?php  echo $_GET['recieve_time_to'];?>");
        $("input[name='batch_code']").val("<?php  echo $_GET['batch_code'];?>");
        $("select[name='status']").val("<?php  echo $_GET['status'];?>");
    });

    /**
     * 重置
     * */
    function reset() {
        $('#form_search').find('input').val('');
        $('#form_search').find('select').val('');
    }
    /**
     * 下载
     */
    $("#download").click(function () {
        var param = '';
        var recieve_time_from = $("input[name='recieve_time_from']").val();
        var recieve_time_to = $("input[name='recieve_time_to']").val();
        var id = $("input[name='id']").val();
        var batch_code = $("input[name='batch_code']").val();
        var status = $("select[name='status']").val();

        if ($.trim(batch_code) != '') {
            param += "&batch_code=" + batch_code;
        }
        if ($.trim(id) != '') {
            param += "&id=" + id;
        }
        if ($.trim(status) != '') {
            param += "&status=" + status;
        }
        if ($.trim(recieve_time_from) != '') {
            param += "&recieve_time_from=" + $.trim(recieve_time_from);
        }
        if ($.trim(recieve_time_to) != '') {
            param += "&recieve_time_to=" + $.trim(recieve_time_to);
        }
        if (param != '') {
            param = '?' + param.substr(1);
        }
        window.location.href = '__URL__/recieved_wait_storage_download' + param;
    });
</script>
